<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>购物车</title>

<link rel="stylesheet" href="${basePath }static/css/shoppingCar/carts.css">
<link rel="stylesheet" href="${basePath }static/css/shoppingCar/reset.css">
<link rel="stylesheet" href="${basePath}static/adminManager/assets/css/amazeui.min.css" />
<link rel="stylesheet" href="${basePath}static/adminManager/assets/css/admin.css">

</head>

<!-- 隐藏内容 -->
<input type="hidden" id="usertel" name="usertel" value="<%=session.getAttribute("userTel") %>" />

<body>
	<form id="alipayment" class="form-horizontal" action="${basePath }jump?pg=alipay/alipay.trade.page.pay" method="post">
<!-- 					<dt>商户订单号 ：</dt> -->
						<input id="WIDout_trade_no" name="WIDout_trade_no" type="hidden"/>
<!-- 					<dt>订单名称 ：</dt> -->
						<input id="WIDsubject" name="WIDsubject" type="hidden"/>
<!-- 					<dt>付款金额 ：</dt> -->
						<input id="WIDtotal_amount" name="WIDtotal_amount" type="hidden"/>
<!-- 					<dt>商品描述：</dt> -->
						<input id="WIDbody" name="WIDbody" type="hidden"/>
		
		<section class="cartMain">
			<div class="cartMain_hd">
				<ul class="order_lists cartTop">
					<li class="list_con"></li>
					<li class="list_price">单价</li>
					<li class="list_amount">数量</li>
					<li class="list_sum">金额</li>
					<li class="list_op">操作</li>
				</ul>
			</div>
			
			
			<!-- 查询后的结果 -->
			<div class="cartBox" >
				<div id="myfugai" class="order_content">
					<ul class="order_lists">
						<li class="list_chk"><input type="checkbox" id="checkbox_2"
							class="son_check"> <label for="checkbox_2"></label></li>
						
						<div id="displaytbody2"></div>
						
						<li class="list_op">
							<p class="del">
								<a href="javascript:" class="delBtn">移除商品</a>
							</p>
						</li>
					</ul>
				</div>
			</div>
			
			
			<!--底部-->
			<div class="bar-wrapper">
				<div class="bar-right">
					<div class="piece">
						已选商品<strong class="piece_num">0</strong>件
					</div>
					<div class="totalMoney">
						共计: <strong class="total_text">0.00</strong>
					</div>
					<div class="calBtn">
						<button onclick="submit">
						 <a>结算</a>
 					</button>
<%--	<a href="${basePath }jump?pg=alipay/alipay.trade.page.pay">结算</a> --%>
						<!--<a href="${basePath }alipay/alipay.trade.page.pay.jsp" target="_blank" >结算</a>-->
					</div>
				</div>
			</div>
		</section>
	</form>
	
	<section class="model_bg"></section>
	<section class="my_model">
		<p class="title">
			删除手机<span class="closeModel">X</span>
		</p>
		<p>您确认要删除该手机吗？</p>
		<div class="opBtn">
			<a href="javascript:;" class="dialog-sure">确定</a> <a
				href="javascript:;" class="dialog-close">关闭</a>
		</div>
	</section>
	
</body>


<!--引入jquery-->
<script type="text/javascript" src="${basePath }static/js/jquery-1.12.4.min.js"></script>
<script type="text/javascript" src="${basePath }static/js/shoppingCar/carts.js"></script>


<script type="text/javascript">
	// 使用jquery进行ajax处理
	$(function()  {
		
		//加载闲置必填信息
		GetDateNow();
		
		// 使用jquery进行ajax请求处理
		$.ajax({
			type : "POST", // 请求类型
			url : "QueryshopppingCar", // 请求的url
			data : "usertel=" + $("#usertel").val(), //$("#form1").serialize(), // 发送的数据 使用serialize方法替代手动拼写数据串
			dataType : "json", // 响应发挥的数据类型  
			success : function(data, textStatus, jqXHR) { // 执行成功之后的回调函数
				// 回调函数的dom操作
				// 解析json数据
				// 解析json数据，在控制台显示查询结果
				console.info(data);
			
				var proData=data.valueOf();
				var strHtml = '';
				var sumMount ='';
				$.each(proData,function(index,item){
					
					strHtml+='<li class="list_con"><div class="list_text"><a id="nam">';
					strHtml+=item.phoneMsg.phonename;
					strHtml+='</a></div></li><li class="list_price"><p id="pri" class="price">￥';
					strHtml+=item.phoneMsg.phoneprice;
					strHtml+='</p></li><li class="list_amount"><div class="amount_box"><input type="text" value="';
					strHtml+=item.shoppnum;
					strHtml+='" class="sum"></div></li><li class="list_sum"><p class="sum_price" id="sumMoeny">￥';
					strHtml+=item.phoneMsg.phoneprice;
					strHtml+='</p></li>';
					
					sumMount = sum(item.phoneMsg.phoneprice,item.shoppnum);
				});
				
				$("#displaytbody2").html(strHtml);
				$("#sumMoeny").html(sumMount);
				
				//前台隐藏的金额
				$("#WIDtotal_amount").val(sumMount);

			},
			error : function(data) {
				alert("请求失败" + data);
			}
		});
	});
</script>
<script type="text/javascript">
//对价格和数量进行计算
function sum(phoneprice,phonenum){
	
	var strNum1 = phoneprice; 
	var strNum2 = phonenum;
	var strNum1 = parseFloat(strNum1); //转换为浮点数
	var strNum2 = parseInt(strNum2); //整数
		
	var sumNumber = strNum1*strNum2;
	
	return sumNumber;
}

</script>
<script type="text/javascript">
function submitOrder(){
	
	// 手动提交form表单
	$("#alipayment").submit();
	
}



function GetDateNow() {
	var vNow = new Date();
	var sNow = "";
	sNow += String(vNow.getFullYear());
	sNow += String(vNow.getMonth() + 1);
	sNow += String(vNow.getDate());
	sNow += String(vNow.getHours());
	sNow += String(vNow.getMinutes());
	sNow += String(vNow.getSeconds());
	sNow += String(vNow.getMilliseconds());
	document.getElementById("WIDout_trade_no").value =  sNow;
	document.getElementById("WIDsubject").value = "测试";
	document.getElementById("WIDtotal_amount").value = "0.01";
}
</script>



</html>